package org.goatsoft.catchpeaks.player;

import org.goatsoft.catchpeaks.Card;
import org.goatsoft.catchpeaks.Player;
import org.goatsoft.catchpeaks.Util;

public class FirstMatchPlayer implements Player {

	@Override
	public void gameStarted() {

	}

	@Override
	public int move(Card[] state) {
		for (int i = state.length - 2; i >= 0; i--) {
			if (Util.isValidMove(state, i)) {
				return i;
			}
		}
		return state.length - 1;
	}

	@Override
	public void gameEnded() {
	}
}